package com.sesame.user.service;

import com.codingapi.txlcn.tc.annotation.TxcTransaction;
import com.sesame.user.bean.User;
import com.sesame.user.dao.UserDao;
import kim.sesame.framework.exception.BusinessException;
import lombok.extern.apachecommons.CommonsLog;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * UserService
 * @author admin
 * @date 2019-01-30 13:03:18
 * @Description: 
 */
@CommonsLog
@Service
public class UserService {

    @SuppressWarnings("all")
	@Resource
	private UserDao userDao;

	
	/**
	 * 修改
	 * @author admin
     * @date 2019-01-30 13:03:18
     * @Description:	
	 */
	@TxcTransaction
	@Transactional(rollbackFor = Exception.class)
	public int update(User bean)  {

		int res = userDao.update(bean);

		if (bean.getUpdateUser().equals("003")) {
			throw new BusinessException("模拟异常");
		}
		
		return res;
	}

}
